Is it possible to make case:
But does not work I only find solution like:
Why this happens we know that runtime the type is Module, we have to be able to cast the object. Dinio - Fri Dec 18 09:34:10 EST 2015 |
Re: Cast Item To Module ? The "Module" type in DXL does not represent an Item. An Item is a Container, either a Folder/Project (contains Other Items), a "Formal Module" (contains module versions) or a "Link Module" (contains link module versions). The "Module" DXL Type represents a loaded ModuleVersion (current or Baseline). Therefore you cannot cast an Item to a Module. You need to explicitly open the current version or a baseline of the item to retrieve a Module variable. Regards, Mathias
Edit: By the way - if the module is already opened, you can get the module handle from the Item
Item I
...
if (type I == "Formal" || type I == "Link") {
Module mod = module I // if the module is open, you will get the handle here
if (mod == null) mod = read(...)
}
|